#include <stdio.h>
#include <string.h>
int main()
{ 
	char start[201];
	scanf("%s",start);
	char operate[201];
	int len=strlen(start);
	while(1)
	{
		scanf("%s",operate);
		if(operate[0]=='c'&&operate[1]=='d'&&operate[2]==' ')
		{
			if(operate[3]=='/')
			strcpy(start,operate+3);
		}
		else if(operate=="pwd")
		{
			break;
		}
	}
	printf("%s",start);
	return 0;
}
